﻿namespace IBTrader.Indicator.Average
{
    using IBTrader.Modules.Read;
    using IBTrader.Charts;

    class TRIX : XEMA
    {
        private Line last = null;
        public TRIX(Worker worker, double interval = 20) : base(worker, new ChartArgs { Group = 1 }, interval, interval, interval) 
        {
            emas[2].Hit += DoHit;
        }
        private void DoHit(object _, Line line)
        {
            if (last != null)
                OnHit(line, ((line.Price - last.Price) / last.Price));
            last = line;
        }
    }
}